<template>
  <header>
    <!-- 头部 -会员专属福利 -->
    <div class="user_bar">
      <div class="head_box"></div>
      <div class="user_box">
        <div class="img_box">
          <div class="img">
            <img src="/img/my/head_sculpture.jpg" alt="head-sculpture" />
          </div>
        </div>
        <p class="user_name">{{account}}</p>
        <div class="advertisement">
          <img src="/img/my/advertisement.png" alt="advertisement" />
        </div>
      </div>
    </div>
    <!-- 用户功能区 -->
    <ul class="user_area">
      <li>
        <div class="img"><img src="/img/my/home.png" alt="home" /></div>
        <span>我的主页</span>
      </li>
      <li>
        <div class="img">
          <img src="/img/my/information.png" alt="information" />
        </div>
        <span>消息</span>
      </li>
      <router-link tag="li" to="/collect">
        <div class="img"><img src="/img/my/collect.png" alt="collect" /></div>
        <span>收藏</span>
      </router-link>
      <router-link tag="li" to="/attention">
        <div class="img">
          <img
            src="/img/my/follow-with-interest.png"
            alt="follow-with-interest"
          />
        </div>
        <span>关注</span>
      </router-link>
    </ul>
    <!-- 购物车区 -->
    <div class="shopping_cart_area">
      <router-link tag="div" to="/shoppingCar" class="shopping_cart">
        <p>购物车</p>
      </router-link>
      <ul class="wallet">
        <li>
          <span>卡券红包</span>
          <a href="javascript:;">
            7张活动券
            <van-image width="5" height="9" src="/img/my/right.png" />
          </a>
        </li>
        <li>
          <span>补贴保障</span>
          <a href="javascript:;">
            退货补运费
            <van-image width="5" height="9" src="/img/my/right.png" />
          </a>
        </li>
        <li>
          <span>我的钱包</span>
          <a href="javascript:;">
            白付美在这
            <van-image width="5" height="9" src="/img/my/right.png" />
          </a>
        </li>
      </ul>
    </div>
    <!-- 订单区 -->
    <div class="the_order_area">
      <div class="title_box">
        <router-link tag="p" to="/order" class="title">
          <span>我的订单</span>
          <a href="javascript:;">
            全部
            <van-image width="5" height="9" src="/img/my/right.png" />
          </a>
        </router-link>
      </div>
      <ul class="user_area con">
        <li>
          <div class="img">
            <van-image
              width="100%"
              height="100%"
              src="/img/my/pay-by-card.png"
              alt="pay-by-card"
            />
          </div>
          <span>待付款</span>
        </li>
        <li>
          <div class="img">
            <van-image
              width="100%"
              height="100%"
              src="/img/my/send-out-goods.png"
              alt="send-out-goods"
            />
          </div>
          <span>待发货</span>
        </li>
        <li>
          <div class="img">
            <van-image
              width="100%"
              height="100%"
              src="/img/my/take-delivery-of-goods.png"
              alt="take-delivery-of-goods"
            />
          </div>
          <span>待收货</span>
        </li>
        <li>
          <div class="img">
            <van-image
              width="100%"
              height="100%"
              src="/img/my/appraise.png"
              alt="appraise"
            />
          </div>
          <span>评价</span>
        </li>
        <li>
          <div class="img">
            <van-image
              width="100%"
              height="100%"
              src="/img/my/drawback.png"
              alt="drawback"
            />
          </div>
          <span>退款售后</span>
        </li>
      </ul>
    </div>
    <!-- 设置区 -->
    <div class="the_order_area">
      <div class="title_box">
        <p class="title">
          <span>我的设置</span>
        </p>
      </div>
      <ul class="user_area">
        <li>
          <div class="img">
            <van-image
              width="100%"
              height="100%"
              src="/img/my/sign-in.png"
              alt="sign-in"
            />
          </div>
          <span>签到</span>
        </li>
        <li>
          <div class="img">
            <van-image
              width="100%"
              height="100%"
              src="/img/my/water.png"
              alt="water"
            />
          </div>
          <span>大姨妈</span>
        </li>
        <li>
          <div class="img">
            <van-image
              width="100%"
              height="100%"
              src="/img/my/customer-service.png"
              alt="customer-service"
            />
          </div>
          <span>客服</span>
        </li>
        <li>
          <div class="img">
            <van-image
              width="100%"
              height="100%"
              src="/img/my/An-expert.png"
              alt="An-expert"
            />
          </div>
          <span>达人中心</span>
        </li>
      </ul>
    </div>
    <!-- 退出登录 -->
    <div class="out_login_box">
      <button @click="outLogin" class="out_login">退出登录</button>
    </div>
  </header>
</template>

<script>
export default {
  data() {
    return {
      // 账号 
      account:'',
    };
  },
  mounted(){
    this.account = JSON.parse(localStorage.getItem('user')).account;
  },
  methods: {
    // 退出登录
    outLogin(){
      localStorage.setItem('loggingStatus',false);
      this.$router.push('/login');
    },
  },
};
</script>

<style lang="scss" scoped>
p {
  margin: 0;
}
header {
  background-color: #f2f2f2;
  padding-bottom: 20px;
  .user_bar {
    position: relative;
    height: 181px;
    margin-bottom: 10px;
    .head_box {
      background: url("/public/img/my/nav_background.png");
      background-size: 100% 100%;
      height: 80px;
    }
  }
}
.user_box {
  width: 93.6%;
  position: absolute;
  top: 45px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #fff;
  border-radius: 8px;
  padding-top: 41px;
  .img_box {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, -50%);
    &::before {
      position: absolute;
      content: "";
      width: 20px;
      height: 20px;
      background: url("/public/img/my/v1.png");
      background-size: cover;
      bottom: 0;
      right: 0;
    }
  }
  .img {
    width: 62px;
    height: 62px;
    line-height: 62px;
    text-align: center;
    border-radius: 50%;
    overflow: hidden;
    background-color: #fff;
    border: 2px solid #fff;
    img {
      width: 100%;
    }
  }
  .user_name {
    font-size: 17px;
    color: #5e5e5e;
    font-weight: 700;
    text-align: center;
    margin: 10px 0;
  }
  .advertisement {
    height: 54px;
    img {
      width: 100%;
      height: 100%;
    }
  }
}
.user_area {
  width: 93.6%;
  margin: 0 auto;
  display: flex;
  height: 69px;
  background-color: #fff;
  border-radius: 5px;
  &.con {
    width: 100%;
    justify-content: space-between;
  }
  li {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    .img {
      width: 25px;
      height: 25px;
      margin-bottom: 4px;
    }
    img {
      width: 100%;
      height: 100%;
    }
    span {
      font-size: 12px;
      color: #5e5e5e;
    }
  }
}
.shopping_cart_area {
  width: 93.6%;
  margin: 0 auto;
  display: flex;
  margin-top: 10px;
  .shopping_cart {
    width: 48.7%;
    height: 120px;
    background-color: #fff;
    border-radius: 5px;
    background: url("/public/img/my/shopping_cart.png");
    background-size: cover;
    margin-right: 9px;
    p {
      font-size: 14px;
      color: #333;
      padding-top: 10px;
      padding-left: 12px;
    }
  }
  .wallet {
    width: 48.7%;
    height: 120px;
    background-color: #fff;
    padding: 0 12px;
    border-radius: 5px;
    li {
      height: 39px;
      display: flex;
      border-bottom: 1px solid #efefef;
      justify-content: space-between;
      align-items: center;
      align-content: center;
    }
    span {
      font-size: 14px;
      color: #333;
    }
    a {
      font-size: 12px;
      color: #999;
    }
  }
}
.the_order_area {
  width: 93.6%;
  margin: 0 auto;
  background-color: #fff;
  border-radius: 5px;
  margin-top: 10px;
  .title_box {
    padding: 0 12px;
    .title {
      height: 39px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      align-content: center;
      border-bottom: 1px solid #efefef;
    }
    span {
      font-size: 14px;
      color: #333;
    }
    a {
      font-size: 12px;
      color: #999;
    }
  }
}
.out_login_box {
  margin-top: 10px;
  margin-bottom: 40px;
  text-align: center;
  .out_login {
    width: 93.6%;
    height: 40px;
    background-color: #ff5777;
    border-radius: 5px;
    color: #fff;
    font-size: 15px;
    border: none;
  }
}
</style>